package algorithm.unionfind;

public abstract class AbstractUnionFind implements UnionFind {

    protected int[] data;

    protected int count;

    public AbstractUnionFind(int n){
        this.data = new int[n];
        count = n;
        for (int i = 0; i < n; i++) {
            this.data[i] = i;
        }
    }


    @Override
    public boolean isConnected(int p, int q) {
        return find(p)==find(q);
    }
}
